#pragma once

#include "Framework.hpp"

class Multishader;
struct BrowseableFileType;
class Font;


class ITwCallbackListener
{
public:
	virtual ~ITwCallbackListener() { }

	virtual void TwSetVar(uint tag, const void *data) { }
	virtual void TwGetVar(uint tag, void *outData) { }
	virtual void TwButton(uint tag) { }
};

struct TwCallbackContext
{
	TwCallbackContext() { }
	TwCallbackContext(ITwCallbackListener *listener, uint tag) : Listener(listener), Tag(tag) { }

	ITwCallbackListener *Listener;
	uint Tag;
};

class IScreen
{
public:
	virtual ~IScreen() { }
	virtual void Init() = 0;
	virtual void Update() = 0;
	virtual void Render3d() = 0;
	virtual void Render2d() = 0;
	virtual bool OnKeyDown(uint4 Key) = 0;
	virtual bool OnKeyUp(uint4 Key) = 0;
	virtual bool OnChar(char Ch) = 0;
	virtual bool OnMouseMove(const common::VEC2 &Pos) = 0;
	virtual bool OnMouseButton(const common::VEC2 &Pos, frame::MOUSE_BUTTON Button, frame::MOUSE_ACTION Action) = 0;
	virtual bool OnMouseWheel(const common::VEC2 &Pos, float Delta) = 0;
	virtual bool ProcessConsoleCommand(common::Tokenizer &tokenizer) { return false; }
};


bool IsTexturePreviewEnabled();
IDirect3DTexture9 * GetEmptyDiffuseTexture();
IDirect3DTexture9 * GetEmptyNormalTexture();
Multishader * GetUniversalShader();
BrowseableFileType * GetTextureFileType();
Font * GetMainFont();
Font * GetTtFont();

TwSetVarCallback GetTwSetVarCallback();
TwGetVarCallback GetTwGetVarCallback();
TwButtonCallback GetTwButtonCallback();

// Supports normal 2D textures and cube textures.
void RenderTexturePreview(
	const common::RECTF &Rect,
	IDirect3DBaseTexture9 *Texture,
	DWORD Channels = D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE);
